package com.team.engine.user.dao;

import java.rmi.server.UID;
import java.util.Date;
import java.util.List;
import java.util.UUID;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import com.team.engine.basedao.BaseEntity;

/**
 * 用户，表实体
 * @author MengLH
 * @data 2010-8-4
 */
@Entity
@Table(name="user_nav")
public class UserNav extends BaseEntity {
	
	/**
	 * 用户Id
	 */
	@Id
	@Column(name="user_id", unique=true)
	private String userId;
	
	/**
	 * 用户名
	 */
	@Column
	private String name;
	
	/**
	 * 邮箱
	 */
	@Column
	private String email;
	
	/**
	 * 手机号
	 */
	@Column
	private Integer phone;
	
	/**
	 * 密码
	 */
	@Column
	private String password;
	
	/**
	 * 注册时间
	 */
	@Column(name="register_time")
	@Temporal(TemporalType.TIMESTAMP)
	private Date registerTime;
	
	/**
	 * 用户详细
	 */
	@OneToOne(cascade=CascadeType.ALL)
	@PrimaryKeyJoinColumn
	private UserDetails userDetails;
	
	@Transient
	private UserGroup usergroup;

	/**
	 * 用户组，用户，关联
	 */
//	@OneToMany(cascade=CascadeType.ALL, mappedBy="userNav")
//	@ManyToMany(cascade=CascadeType.ALL)
//	@JoinTable(name="userNav_userGroupUser", joinColumns=@joinColumn(name="user_id"))
//	private List<UserGroupUser> userGroupUser;
	
	public String getUserId() {
		return userId = userId;
	}

	public UserGroup getUsergroup() {
		return usergroup;
	}

	public void setUsergroup(UserGroup usergroup) {
		this.usergroup = usergroup;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public Integer getPhone() {
		return phone;
	}

	public void setPhone(Integer phone) {
		this.phone = phone;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public Date getRegisterTime() {
		return registerTime;
	}

	public void setRegisterTime(Date registerTime) {
		this.registerTime = registerTime;
	}

	public UserDetails getUserDetails() {
		return userDetails;
	}

	public void setUserDetails(UserDetails userDetails) {
		this.userDetails = userDetails;
	}

//	public List<UserGroupUser> getUserGroupUser() {
//		return userGroupUser;
//	}
//
//	public void setUserGroupUser(List<UserGroupUser> userGroupUser) {
//		this.userGroupUser = userGroupUser;
//	}
	
}
